package com.max.mil.controller;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CoreFilter implements Filter
{

	@Override
	public void init(FilterConfig arg0) throws ServletException 
	{
		// TODO Auto-generated method stub
	}
	

	@Override
	public void doFilter(ServletRequest req, ServletResponse rsp,
			FilterChain chain) throws IOException, ServletException 
	{
		HttpServletRequest request = (HttpServletRequest)req;
		HttpServletResponse response = (HttpServletResponse)rsp;
		
		String client_id = "10410013081500000152";//6e5755b9a67bb22cae17d9c03585e14d
		String response_type = "code";
		String redirect_uri = "qq.com";
		String scope = "";
		String state = "";
		String view = "";
		
		StringBuffer sb = new StringBuffer();
		sb.append("http://fuwu.1mall.com/login/authorize.action")
		  .append("?client_id=").append(client_id)
		  .append("&response_type=").append(response_type)
		  .append("&redirect_uri=").append(redirect_uri)
		  .append("&scope=").append(scope)
		  .append("&state=").append(state)
		  .append("&view=").append(view);
		System.out.println(sb.toString());
		
		response.sendRedirect(sb.toString());
	}
	

	@Override
	public void destroy() 
	{
		// TODO Auto-generated method stub
	}
}
